home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
shotbl.arc
/
SHTABLES.C
< prev
next >
Wrap
Text File
|
1989-01-03
|
19KB
|
608 lines
/*****************************************************************************
*
* Program Name: SHELL INTERNAL TABLE DISPLAY
*
* Filename: shtables.c
*
* Date Created: November 18, 1988
*
* Version: 1.0
*
* Programmers: Thomas Brough
*
* Files used: window.c, maptable.asm, screen.asm, video.h, typedef.h
*
* Date Modified:
*
* Modifications:
*
* Comments:
*
****************************************************************************/
#include <stdio.h>
#include <dos.h>
#include "video.h"
#include "typedef.h"
NAME SNTable[8];
BYTE DSTable[32];
BYTE DFTable[32];
BYTE DHTable[32];
SERVER CITable[8];
int currentLocation=1, prevLocation=1;
main()
{
char acode=0, ecode=0;
InitTables();
SetUpScreen();
while ( 1 )
{
getcha( &acode, &ecode );
prevLocation = currentLocation;
if ( ecode )
{
switch( acode )
{
case 'S':
case 's':
currentLocation=1;
Menu( currentLocation, prevLocation );
break;
case 'H':
case 'h':
currentLocation=2;
Menu( currentLocation, prevLocation );
break;
case 'F':
case 'f':
currentLocation=3;
Menu( currentLocation, prevLocation );
break;
case 'D':
case 'd':
currentLocation=4;
Menu( currentLocation, prevLocation );
break;
case 'N':
case 'n':
currentLocation=5;
Menu( currentLocation, prevLocation );
break;
case 'A':
case 'a':
currentLocation=6;
Menu( currentLocation, prevLocation );
break;
case 'Q':
case 'q':
currentLocation=7;
Menu( currentLocation, prevLocation );
break;
case 13:
Execute( currentLocation ); /* enter key */
break;
case 27:
Execute( 7 );
break;
default:
break;
} /* switch */
} /* if ecode */
else
{
switch( acode )
{
case 72:
if (currentLocation == 1) /* up arrow key */
currentLocation = 7;
else
currentLocation--;
Menu( currentLocation, prevLocation );
break;
case 80:
if (currentLocation == 7) /* down arrow key */
currentLocation = 1;
else
currentLocation++;
Menu( currentLocation, prevLocation );
break;
default:
break;
} /* switch */
} /* else */
} /* while */
} /* main */
getcha(acode, ecode)
char *ecode, *acode;
{
union REGS inregs, outregs;
inregs.h.ah = 8;
intdos( &inregs, &outregs);
*ecode = outregs.h.al;
if (*ecode == 0)
{
inregs.h.ah = 8;
intdos(&inregs, &outregs);
*acode = outregs.h.al;
return(0);
}
else
{
*acode = *ecode;
*ecode = 1;
}
}
ErrorExit( errorString, ccode )
char *errorString;
int ccode;
{
ClearScreen();
SetCursorPosition( 10, 10 );
printf( "Error: %s", errorString );
exit( ccode );
}
SetUpScreen()
{
mode = GetVideoMode();
SetVideoSegmentAddress( mode, &destseg );
if (destseg == 0xB000)
{
NORMAL = 0x07; /* monochrome display */
REVERSE = 0x70;
BOLD = 0x0F;
BACKGROUND = 0x07;
}
else
{
NORMAL = 0x7F; /* color display */
REVERSE = 0x1E;
BOLD = 0x7E;
BACKGROUND = 0x70;
}
ColorScreen( BACKGROUND );
DrawWindow( 1, 1, 24, 80, destseg, BOLD );
DrawWindow( 1,1,9,26, destseg, BOLD );
PrintStringAttr( "This utility displays some of the internal tables", NORMAL, MESSAGE3, destseg );
PrintStringAttr( "of the Novell NetWare workstation shell.", NORMAL, MESSAGE4, destseg );
RemoveCursor();
PrintStringAttr( " Connection Info. Table ", REVERSE, CITABLE, destseg );
PrintStringAttr( " Drive Handle Table ", NORMAL, DHTABLE, destseg );
PrintStringAttr( " Drive Flag Table ", NORMAL, DFTABLE, destseg );
PrintStringAttr( " Drive Connection ID ", NORMAL, DSTABLE, destseg );
PrintStringAttr( " Server Name Table ", NORMAL, SNTABLE, destseg);
PrintStringAttr( " All Drive Tables ", NORMAL, ALTABLE, destseg);
PrintStringAttr( " Exit to DOS ", NORMAL, QUIT, destseg);
}
Menu( curr, prev )
int curr, prev;
{
switch(prev)
{
case 1:
PrintStringAttr( " Connection Info. Table ", NORMAL, CITABLE, destseg );
break;
case 2:
PrintStringAttr( " Drive Handle Table ", NORMAL, DHTABLE, destseg );
break;
case 3:
PrintStringAttr( " Drive Flag Table ", NORMAL, DFTABLE, destseg );
break;
case 4:
PrintStringAttr( " Drive Connection ID ", NORMAL, DSTABLE, destseg );
break;
case 5:
PrintStringAttr( " Server Name Table ", NORMAL, SNTABLE, destseg );
break;
case 6:
PrintStringAttr( " All Drive Tables ", NORMAL, ALTABLE, destseg );
break;
case 7:
PrintStringAttr( " Exit to DOS ", NORMAL, QUIT, destseg );
break;
} /* switch */
switch(curr)
{
case 1:
PrintStringAttr( " Connection Info. Table ", REVERSE, CITABLE, destseg );
break;
case 2:
PrintStringAttr( " Drive Handle Table ", REVERSE, DHTABLE, destseg );
break;
case 3:
PrintStringAttr( " Drive Flag Table ", REVERSE, DFTABLE, destseg );
break;
case 4:
PrintStringAttr( " Drive Connection ID ", REVERSE, DSTABLE, destseg );
break;
case 5:
PrintStringAttr( " Server Name Table ", REVERSE, SNTABLE, destseg);
break;
case 6:
PrintStringAttr( " All Drive Tables ", REVERSE, ALTABLE, destseg );
break;
case 7:
PrintStringAttr( " Exit to DOS ", REVERSE, QUIT, destseg);
break;
} /* switch */
}
/*
** This function will multiplex to the appropriate procedure.
*/
Execute( curr )
int curr;
{
switch(curr) {
case 1:
ShowConnectionInfoTable();
break;
case 2:
ShowDriveHandleTable();
break;
case 3:
ShowDriveFlagTable();
break;
case 4:
ShowDriveServerTable();
break;
case 5:
ShowServerNameTable();
break;
case 6:
ShowAllDriveTables();
break;
case 7:
Quit();
break;
default:
break;
} /* switch */
}
/*
** This function will terminate execution and restore the cursor.
*/
Quit()
{
if (destseg == 0xB000)
RestoreCursor( 0 );
else
RestoreCursor( 1 );
ClearScreen();
exit( 0 );
}
ShowConnectionInfoTable()
{
int i, j;
CleanUpScreen();
PrintStringAttr( "The Connection Info table is used by the shell ", NORMAL, MESSAGE1, destseg );
PrintStringAttr( "when sending packets to different file servers. ", NORMAL, MESSAGE2, destseg );
PrintStringAttr( "This table contains the complete network address ", NORMAL, MESSAGE3, destseg );
PrintStringAttr( "for each of the file servers it is communicating ", NORMAL, MESSAGE4, destseg );
PrintStringAttr( "with, as well as the nearest router in case the ", NORMAL, MESSAGE5, destseg );
PrintStringAttr( "file server exists on another physical network. ", NORMAL, MESSAGE6, destseg );
PrintStringAttr( "Also kept are packet sequence numbers and timeout", NORMAL, MESSAGE7, destseg );
PrintStringAttr( "values to coordinate requests with file servers. ", NORMAL, MESSAGE8, destseg );
PrintStringAttr( "C O N N E C T I O N I N F O T A B L E ", BOLD, TITLE, destseg );
PrintStringAttr( "Conn Order File Server Recv. Router Seq. Conn Conn Max ", REVERSE, HEADER1, destseg );
PrintStringAttr( "InUse No. Network Address Timeout Add. No. No. Stat Time ", REVERSE, HEADER2, destseg );
for (i=0;i<8;i++)
{
SetCursorPosition( i+15, 2 );
switch( CITable[i].InUseFlag )
{
case 0xFF:
printf( "YES");
break;
case 0x00:
printf( "NO");
break;
default:
break;
}
SetCursorPosition( i+15, 8 );
printf( "%d", CITable[i].ConnID );
SetCursorPosition( i+15, 11 );
for (j=0;j<4;j++)
printf("%02X", CITable[i].ServerNetAddress[j] );
printf(":");
for (j=0;j<6;j++)
printf("%02X", CITable[i].ServerNodeAddress[j] );
printf(":");
for (j=0;j<2;j++)
printf("%02X", CITable[i].ServerSocket[j] );
SetCursorPosition( i+15, 39 );
for (j=0;j<2;j++)
printf("%d", CITable[i].ReceiveTimeOut[j] );
SetCursorPosition( i+15, 45 );
for (j=0;j<6;j++)
printf("%02X", CITable[i].RouterAddress[j] );
SetCursorPosition( i+15, 59 );
printf( "%d", CITable[i].SeqNumber );
SetCursorPosition( i+15, 64 );
switch( CITable[i].LogicalConnNumber )
{
case 0xFF:
printf( "NONE" );
break;
default:
printf( "%d", CITable[i].LogicalConnNumber );
break;
}
SetCursorPosition( i+15, 70 );
switch( CITable[i].ConnStatus )
{
case 0xFF:
printf( "OK" );
break;
default:
printf( "--" );
break;
}
SetCursorPosition( i+15, 74 );
for (j=0;j<2;j++)
printf( "%d", CITable[i].MaxTimeOut[j] );
}
}
ShowDriveHandleTable()
{
int i;
CleanUpScreen();
PrintStringAttr( "The Drive Handle Table shows the directory handle", NORMAL, MESSAGE1, destseg );
PrintStringAttr( "associated with each mapped drive, whether that ", NORMAL, MESSAGE2, destseg );
PrintStringAttr( "drive is permanent or temporary. The first 26 ", NORMAL, MESSAGE3, destseg );
PrintStringAttr( "drive letters [A..Z] can be mapped as permanent ", NORMAL, MESSAGE4, destseg );
PrintStringAttr( "drives. Any of the 32 drive letters [A..`] can ", NORMAL, MESSAGE5, destseg );
PrintStringAttr( "be mapped as temporary drives. A temporary drive", NORMAL, MESSAGE6, destseg );
PrintStringAttr( "only remains for the lifetime of the application ", NORMAL, MESSAGE7, destseg );
PrintStringAttr( "that created the temporary drive. ", NORMAL, MESSAGE8, destseg );
PrintStringAttr( "Permanent Drives:", BOLD, TITLEA, destseg );
PrintStringAttr( "D R I V E H A N D L E T A B L E", BOLD, TITLE+6, destseg );
PrintStringAttr( " A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ", REVERSE, HEADER1, destseg );
PrintStringAttr( "Temporary Drives:", BOLD, TITLEB, destseg );
PrintStringAttr( " [ \\ ] ^ _ ` ", REVERSE, HEADER3, destseg );
SetCursorPosition( 13, 1 );
for (i=0;i<26;i++)
printf("%02d ", DHTable[i]);
SetCursorPosition( 19, 1 );
for (i=26;i<32;i++)
printf("%02d ", DHTable[i]);
}
ShowDriveFlagTable()
{
int i;
CleanUpScreen();
PrintStringAttr( "─────────── LEGEND ──────────────────────────────", NORMAL, MESSAGE1, destseg );
PrintStringAttr( " ", NORMAL, MESSAGE2, destseg );
PrintStringAttr( " 00 = Not allocated ", NORMAL, MESSAGE3, destseg );
PrintStringAttr( " 01 = PERMANENT network drive ", NORMAL, MESSAGE4, destseg );
PrintStringAttr( " 02 = TEMPORARY network drive ", NORMAL, MESSAGE5, destseg );
PrintStringAttr( " 80 = local drive ", NORMAL, MESSAGE6, destseg );
PrintStringAttr( " 81 = local drive-now a PERMANENT network drive ", NORMAL, MESSAGE7, destseg );
PrintStringAttr( " 82 = local drive-now a TEMPORARY network drive ", NORMAL, MESSAGE8, destseg );
PrintStringAttr( "Permanent Drives:", BOLD, TITLEA, destseg );
PrintStringAttr( "D R I V E F L A G T A B L E", BOLD, TITLE+10, destseg );
PrintStringAttr( " A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ", REVERSE, HEADER1, destseg );
PrintStringAttr( "Temporary Drives:", BOLD, TITLEB, destseg );
PrintStringAttr( " [ \\ ] ^ _ ` ", REVERSE, HEADER3, destseg );
SetCursorPosition( 13, 1 );
for (i=0;i<26;i++)
printf("%02X ", DFTable[i]);
SetCursorPosition( 19, 1 );
for (i=26;i<32;i++)
printf("%02X ", DFTable[i]);
}
ShowDriveServerTable()
{
int i;
CleanUpScreen();
PrintStringAttr( "The Drive Connection ID table shows the server ", NORMAL, MESSAGE1, destseg );
PrintStringAttr( "connection ID associated with each drive, whether", NORMAL, MESSAGE2, destseg );
PrintStringAttr( "that drive is permanent or temporary. Currently,", NORMAL, MESSAGE3, destseg );
PrintStringAttr( "the shell can support up to 8 attachments, so the", NORMAL, MESSAGE4, destseg );
PrintStringAttr( "value for each drive will be from 1-8, indicating", NORMAL, MESSAGE5, destseg );
PrintStringAttr( "which of the possible 8 file servers each drive ", NORMAL, MESSAGE6, destseg );
PrintStringAttr( "is attached to. An value of 0 indicates that the", NORMAL, MESSAGE7, destseg );
PrintStringAttr( "drive is not currently mapped to any server. ", NORMAL, MESSAGE8, destseg );
PrintStringAttr( "Permanent Drives:", BOLD, TITLEA, destseg );
PrintStringAttr( "D R I V E C O N N E C T I O N I D T A B L E", BOLD, TITLE-2, destseg );
PrintStringAttr( " A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ", REVERSE, HEADER1, destseg );
PrintStringAttr( "Temporary Drives:", BOLD, TITLEB, destseg );
PrintStringAttr( " [ \\ ] ^ _ ` ", REVERSE, HEADER3, destseg );
SetCursorPosition( 13, 1 );
for (i=0;i<26;i++)
printf(" %01d ", DSTable[i]);
SetCursorPosition( 19, 1 );
for (i=26;i<32;i++)
printf(" %01d ", DSTable[i]);
}
ShowServerNameTable()
{
int i;
CleanUpScreen();
PrintStringAttr( "The Server Name Table shows the actual file ", NORMAL, MESSAGE1, destseg );
PrintStringAttr( "server name string associated with each ", NORMAL, MESSAGE2, destseg );
PrintStringAttr( "connection ID. A Connection ID can be thought of", NORMAL, MESSAGE3, destseg );
PrintStringAttr( "as the index value into the Server Mapping Table.", NORMAL, MESSAGE4, destseg );
PrintStringAttr( "In other words, the first entry in the Server ", NORMAL, MESSAGE5, destseg );
PrintStringAttr( "Name table corresponds to the first entry in the ", NORMAL, MESSAGE6, destseg );
PrintStringAttr( "Server Mapping Table. ", NORMAL, MESSAGE7, destseg );
PrintStringAttr( " ", NORMAL, MESSAGE8, destseg );
PrintStringAttr( "S E R V E R N A M E T A B L E", BOLD, TITLE+8, destseg );
PrintStringAttr( "Conn File Server ", REVERSE, HEADER1, destseg );
PrintStringAttr( " ID Name ", REVERSE, HEADER2, destseg );
for (i=0;i<8;i++)
{
SetCursorPosition( i+15, 3 );
printf("%d %s", i+1, SNTable[i].serverName );
}
}
ShowAllDriveTables()
{
int i;
CleanUpScreen();
PrintStringAttr( "This screen shows the relationships between the ", NORMAL, MESSAGE1, destseg );
PrintStringAttr( "Drive Handle Table, the Drive Flag Table, and the", NORMAL, MESSAGE2, destseg );
PrintStringAttr( "Drive Server Table. The display order is: ", NORMAL, MESSAGE3, destseg );
PrintStringAttr( " ", NORMAL, MESSAGE4, destseg );
PrintStringAttr( "A B C D E F G H I J K L M N O P...", NORMAL, MESSAGE5, destseg );
PrintStringAttr( "Drive Handle Information (decimal values) ", NORMAL, MESSAGE6, destseg );
PrintStringAttr( "Drive Flag Information (hexadecimal values) ", NORMAL, MESSAGE7, destseg );
PrintStringAttr( "Drive Server Information (decimal values) ", NORMAL, MESSAGE8, destseg );
PrintStringAttr( "Permanent Drives:", BOLD, TITLEA, destseg );
PrintStringAttr( "D R I V E S E R V E R T A B L E", BOLD, TITLE+4, destseg );
PrintStringAttr( " A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ", REVERSE, HEADER1, destseg );
PrintStringAttr( "Temporary Drives:", BOLD, TITLEB, destseg );
PrintStringAttr( " [ \\ ] ^ _ ` ", REVERSE, HEADER3, destseg );
SetCursorPosition( 13, 1 );
for (i=0;i<26;i++)
printf("%02d ", DHTable[i]);
SetCursorPosition( 19, 1 );
for (i=26;i<32;i++)
printf("%02d ", DHTable[i]);
SetCursorPosition( 14, 1 );
for (i=0;i<26;i++)
printf("%02X ", DFTable[i]);
SetCursorPosition( 20, 1 );
for (i=26;i<32;i++)
printf("%02X ", DFTable[i]);
SetCursorPosition( 15, 1 );
for (i=0;i<26;i++)
printf(" %01d ", DSTable[i]);
SetCursorPosition( 21, 1 );
for (i=26;i<32;i++)
printf(" %01d ", DSTable[i]);
}
CleanUpScreen()
{
int i;
for (i = MESSAGE1;i < (MESSAGE8+160) ;i += 160)
PrintStringAttr(" ",
NORMAL, i, destseg );
for (i=10;i<23;i++)
{
PrintStringAttr( " ",
NORMAL, (i*160+2), destseg );
}
}
InitTables()
{
char far *p;
WORD tableSegment;
WORD tableOffset;
int i;
unsigned int dataseg, dataoff;
void GetConnectionInfoTable();
void GetDriveHandleTable();
void GetDriveFlagTable();
void GetDriveServerTable();
void GetServerNameTable();
p = (char far *)&CITable[0];
dataseg = FP_SEG( p );
dataoff = FP_OFF( p );
GetConnectionInfoTable( &tableSegment, &tableOffset) ;
if ( tableSegment == 0 )
ErrorExit( "You must load the NetWare shell to use this utility.", 1 );
for (i=0;i<8;i++)
{
movedata( tableSegment, tableOffset,
dataseg, dataoff, 32 );
dataoff+=32;
tableOffset+=32;
}
p = (char far *)&DHTable[0];
dataseg = FP_SEG( p );
dataoff = FP_OFF( p );
GetDriveHandleTable( &tableSegment, &tableOffset );
if ( tableSegment == 0 )
ErrorExit( "You must load the NetWare shell to use this utility.", 1 );
for (i=0;i<32;i++)
{
movedata( tableSegment, tableOffset,
dataseg, dataoff, 1 );
dataoff++;
tableOffset++;
}
p = (char far *)&DFTable[0];
dataseg = FP_SEG( p );
dataoff = FP_OFF( p );
GetDriveFlagTable( &tableSegment, &tableOffset );
if ( tableSegment == 0 )
ErrorExit( "You must load the NetWare shell to use this utility.", 1 );
for (i=0;i<32;i++)
{
movedata( tableSegment, tableOffset,
dataseg, dataoff, 1 );
dataoff++;
tableOffset++;
}
p = (char far *)&DSTable[0];
dataseg = FP_SEG( p );
dataoff = FP_OFF( p );
GetDriveServerTable( &tableSegment, &tableOffset );
if ( tableSegment == 0 )
ErrorExit( "You must load the NetWare shell to use this utility.", 1 );
for (i=0;i<32;i++)
{
movedata( tableSegment, tableOffset,
dataseg, dataoff, 1 );
dataoff++;
tableOffset++;
}
p = (char far *)&SNTable[0];
dataseg = FP_SEG( p );
dataoff = FP_OFF( p );
GetServerNameTable( &tableSegment, &tableOffset) ;
if ( tableSegment == 0 )
ErrorExit( "You must load the NetWare shell to use this utility.", 1 );
for (i=0;i<8;i++)
{
movedata( tableSegment, tableOffset,
dataseg, dataoff, 48 );
dataoff+=48;
tableOffset+=48;
}
}